package com.emergency.direct.dao;

import com.emergency.base.domain.ScenarRadiation;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

public interface ScenarRadiationDao extends JpaRepository<ScenarRadiation, Long>, JpaSpecificationExecutor<ScenarRadiation> {

    @Modifying
    @Query(value = "delete FROM bus_scenar_radiation WHERE scenar_id = ? ", nativeQuery = true)
    void deleteByScenar(Long id);

    @Query("select sr from ScenarRadiation sr where scenar.id=:id ")
    ScenarRadiation findByScenar(@Param("id") Long id);
}
